{extend name="base" /} {block name="body"}
<div class="layui-body">
	<!--tab标签-->
	<div class="layui-tab layui-tab-brief">
		<ul class="layui-tab-title">
			<li class="">
				<a href="{:url('admin/cas/index')}">案例管理</a>
			</li>
			<li class="layui-this">编辑案例</li>
		</ul>
		<div class="layui-tab-content">
			<div class="layui-tab-item layui-show">
				<form class="layui-form form-container" action="{:url('admin/cas/update')}" method="post">
					<div class="layui-form-item">
						<label class="layui-form-label">标题</label>
						<div class="layui-input-block">
							<input type="text" name="title" value="{$model.title}" placeholder="请输入标题" class="layui-input">
						</div>
					</div>
					
					
					<div class="layui-form-item">
						<label class="layui-form-label">活动封面</label>
						<div class="layui-input-block" id="upload-div">
							<img class="img-see" src="{$model.thumb}" />
							<input type="text" name="thumb" value="{$model.thumb}" readonly class="layui-input layui-input-inline">
							<input type="file" name="file" class="layui-upload-file">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">场地图集</label>
						<div class="layui-input-block">
							<button type="button" id="upload-photo-btn" class="layui-btn">上传图集</button>
							<div id="photo-container">
							</div>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">详细内容</label>
						<div class="layui-input-block">
							<textarea id="content" name="content" class="layui-textarea" lay-verify="content">{$model.content}</textarea>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">访问量</label>
						<div class="layui-input-block">
							<input type="text" name="clicks" value="{$model.clicks}" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">点赞数</label>
						<div class="layui-input-block">
							<input type="text" name="praise" value="{$model.praise}" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">添加时间</label>
						<div class="layui-input-block">
							<input type="text" readonly value="{$model.add_time}" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">修改时间</label>
						<div class="layui-input-block">
							<input type="text" readonly value="{$model.update_time}" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">状态</label>
						<div class="layui-input-block">
							<input type="radio" name="status" value="1" title="显示" {if condition="$model.status==1" } checked="checked" {/if}>
							<input type="radio" name="status" value="0" title="隐藏" {if condition="$model.status==0" } checked="checked" {/if}>
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-input-block">
							<input type="hidden" name="id" value="{$model.id}">
							<button class="layui-btn" lay-submit lay-filter="*">更新</button>
							<button type="reset" class="layui-btn layui-btn-primary">重置</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
{/block}{block name="js"}
<script src="__JS__/kindeditor/kindeditor.config.js"></script>
<script src="__JS__/kindeditor/kindeditor-all-min.js"></script>
{/block} {block name="script"}
<script>
	$(document).ready(function() {
		var _kindEditor;
		KindEditor.ready(function(K) {
			_kindEditor = K.create('#content', KindEditorOptions);
			K('#upload-photo-btn').click(function() {
				var photo_list_item = '';
				_kindEditor.loadPlugin('multiimage', function() {
					_kindEditor.plugin.multiImageDialog({
						showRemote: false,
						imageUrl: K('#photo').val(),
						clickFn: function(data) {
							$.each(data, function(index, item) {
								photo_list_item += '<div class="photo-list"><img src="' + item.url +
									'" class="photo-see" /><input type="text" name="photo[' + item.url + ']" style="display:none;">';
								photo_list_item += '<button class="layui-btn layui-btn-danger remove-photo-btn">移除</button></div>';
							});
							$('#photo-container').append(photo_list_item);
							_kindEditor.hideDialog();
						}
					});
				});
			});
		});

	});
</script>
{/block}